package com.xzit.aop;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author haoranlu
 * @project IntelliJ IDEA
 */
public class OneFilter implements Filter {
    private String ip = "";
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("初始化");
        ip = filterConfig.getInitParameter("ip");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("执行过滤");
       /* if(ip.equals("127.0.0.1")){
            System.out.println("您的被举报，暂时无法访问本网站");
        }else {
          filterChain.doFilter(servletRequest,servletResponse);
        }*/
        filterChain.doFilter(servletRequest,servletResponse);

    }

    @Override
    public void destroy() {

    }
}
